<?php
namespace app\admin\controller;
use app\admin\model\TopicsModel;
use think\Controller;


class  Topics extends Controller{
    /*
     *话题贴列表
     */
    public function index(){
        $model = new TopicsModel();
        $res = $model->selectAll();
        $page = $res->render();
        $this->assign('res',$res);
        $this->assign('page', $page);
        return $this->fetch();
    }

    /*
     *话题删除（逻辑）
     */
    public function delTopics(){
        $id = input('id');
        $model = new TopicsModel();
        $res = $model->deleteRow($id);
        return $res;
    }

    /*
     *批量删除
     */
    public function disCard()
    {
        $id = input('ids');
        $ids = explode(',',$id);
        foreach ($ids as $id){
            $model = new TopicsModel();
            $res[] = $model->deleteAll($id);
        }
        return $res;

    }
}